$(function() {
	$(document).bind("click", function(e) {
		var e = e || window.event; //处理浏览器的兼容性
		var elem = e.target || e.srcElement;
		if($("#ads_menu").css("display") == "block") {
			while(elem) {
				if(elem.id && elem.id == 'nav_header_menu'){
					return;
				}
					
				elem = elem.parentNode;
			}
			$("#ads_menu").css("display", "none");
		}
	});
	//伸缩菜单
	$(".collapse_button").click(function(){
		//获取当前元素的父级元素
		var collapse_parent=$(this).parents(".composition_function_div").eq(0);
		//获取伸缩菜单
		var collapse_menu=collapse_parent.find(".collapse_menu");
		//获取伸缩logo
		var collapse_logo=collapse_parent.find(".collapse_logo");
		if(collapse_menu.css("display")=="block"){
			collapse_menu.slideUp();
			collapse_logo.html("<i class='fa fa-chevron-up' aria-hidden='true'></i>");
		}else{
			collapse_menu.slideDown();
			collapse_logo.html("<i class='fa fa-chevron-down' aria-hidden='true'></i> ")
		}
	});
	
	

});